package com.corelib.mvp.demo.login;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.corelib.BaseActivity;
import com.corelib.BaseApplication;
import com.corelib.R;
import com.corelib.mvp.demo.login.demo.login.presenter.LoginPresenter;
import com.corelib.mvp.demo.login.demo.login.view.LoginView;
import com.orhanobut.logger.Logger;

import butterknife.BindView;


public class LoginActivity extends BaseActivity implements LoginView{
    @BindView(R.id.account)
    EditText accout;

    @BindView(R.id.pas)
    EditText pas;

    @BindView(R.id.submit)
    Button submit;

    LoginPresenter presenter;

    @Override
    protected int inflateLayoutId() {
        return R.layout.activity_login;
    }

    @Override
    protected void initViews(Bundle savedInstanceState) {
        presenter = new LoginPresenter(this);

        submit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                presenter.login(accout.getText().toString(),pas.getText().toString());
            }
        });
    }

    @Override
    public void loginsuccess() {
        Toast.makeText(this,"loginsuccess",Toast.LENGTH_LONG).show();
   }

    @Override
    public void loginfail() {
        Toast.makeText(this,"login error",Toast.LENGTH_LONG).show();
    }
}
